<?php	namespace Home\Controller;
class LoginController extends CommonController
{
	protected $db;
	public function __init()
	{
		$this->db = new \Common\Model\User;
	}
	public function index()
	{
		if(IS_POST)
		{
			if(!$this->db->store())
			{
				View::error($this->db->getError());
			}else
			{
				View::success('注册成功',U('Logo/index'));
			}
		}
		View::make();
	}
	public function nameajax()
	{
		if(IS_AJAX){
			$yname = $_POST['yname'];
			$data = Db::table('user')->where('yname',$yname)->get();
			if($data){
				echo 1 ;
				return;
			}else
			{
				echo 0 ;
			}
		}
	}
	public function code()
	{
		Code::make();
	}
}
